Skip to content

상품 지급하기

지원환경: React NativeWebView
실행환경: Toss App

completeProductGrant

completeProductGrant 함수는 대기 중인 주문의 상품 지급을 완료 처리하는 함수예요.
사용자에게 상품을 지급하고 completeProductGrant 함수를 호출하여 지급 상태를 완료로 변경하세요.

앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 undefined를 반환해요.

시그니처

typescript
function completeProductGrant(params: {
  params: {
    orderId: string;
  };
}): Promise<boolean | undefined>;

파라미터

  • { params: { orderId: string } }

    결제가 완료된 주문 정보를 담은 객체예요.

    • params.orderIdstring

      주문의 고유 ID예요. 상품 지급을 완료할 주문을 지정할 때 사용해요.

반환값

  • Promise<boolean | undefined>

    상품 지급이 완료됐는지 여부를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.233.0, iOS 5.233.0)보다 낮으면 undefined를 반환해요.

예제

tsx
 import { IAP } from '@apps-in-toss/framework';
 
 async function handleGrantProduct(orderId: string) {
   try {
     await IAP.completeProductGrant({ params: { orderId } });
   } catch (error) {
     console.error(error);
   }
 }